package org.thanos.baseline.controller;


import jakarta.annotation.Resource;
import org.springframework.http.MediaType;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.servlet.ModelAndView;
import org.thanos.baseline.service.BaselineService;
import org.thanos.baseline.vo.QueryVO;
import org.thanos.baseline.vo.ResultVO;


@Controller
public class BaselineController {

    @Resource
    private BaselineService baselineService;

    @PostMapping(path = "/baseline", consumes = MediaType.APPLICATION_JSON_VALUE, produces = MediaType.APPLICATION_JSON_VALUE)
    @ResponseBody
    public ResultVO baselineValue(@RequestBody QueryVO queryVO) {
        return baselineService.baselineData(queryVO);
    }

    @GetMapping("/")
    public ModelAndView index(ModelAndView view) {
        view.setViewName("index");
        return view;
    }

    @GetMapping("/dashboard")
    public ModelAndView dashboard(ModelAndView view) {
        view.setViewName("dashboard/dashboard");
        return view;
    }
}
